package SocketTool;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetSocketAddress;
import java.net.SocketException;

public class UDP1 {
	//作为发送方
public static void main(String[] args) {
		String str="我是数据";
		InetSocketAddress ipPort=new InetSocketAddress("192.168.1.129",6355);
		try {
			DatagramPacket dp=new DatagramPacket(str.getBytes(),str.length(),ipPort);
			DatagramSocket ds=new DatagramSocket(6352);
			ds.send(dp);
		} catch (SocketException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
}
}
